package com.apes.enquiry.product.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.apes.framework.jpa.BaseModel;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.audit.Auditing;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.jpa.tuple.date.DateTime;
import com.apes.framework.util.DateUtil;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;
import java.util.Date;

/**
 * 类描述：标准名称
 *
 * @ClassName Category
 * @Description 描述
 * @Author wushilong
 * @Date 2022/12/1 15:37
 * @Version 1.0
 */
@Auditing
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = Category.CONST_TABLE_NAME)
public class Category extends BaseModel {
    public static final String CONST_TABLE_NAME = "MAS_PJMC";

    @Id
    @Column(name = "id", length = 10)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "标准名称", padding = 10)
    @Comment("商品类目编码")
    private String id; //商品编码

    @Column(name = "name", nullable = false, length = 120)
    @Comment("商品类目名称")
    private String name;

    @Column(name = "classify_id", nullable = false, length = 120)
    @Comment("商品分类编码")
    private String classifyId;

    @Column(name = "classify_name", nullable = false, length = 120)
    @Comment("商品分类名称")
    private String classifyName;

    @Column(name = "TS01", nullable = false, length = 120)
    @Comment("时间戳")
    private String TS;//时间戳

    @Column(name = "entering", nullable = false, length = 120)
    @Comment("录入人")
    private String entering;

    @JSONField(format = DateUtil.SHOW_DATETIME_FORMAT)
    @DateTime
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "entering_date", insertable = false)
    @Comment("录入时间")
    private Date enteringDate;

    @Column(name = "PYM", nullable = false, length = 120)
    @Comment("拼音码")
    private String PYM;

    @Column(name = "recycle_sign")
    @Comment("旧件回收标记")
    private Boolean recycleSign;//旧件回收标记

    @Column(name = "match_product", length = 120)
    @Comment("匹配商品标记")
    private Boolean matchCProduct = false;//匹配商品标记

    @Column(name = "match_color", length = 120)
    @Comment("匹配颜色标记")
    private Boolean matchColor = false;//匹配颜色标记

    @Column(name = "electronic_components", length = 120)
    @Comment("电子元器件")
    private Boolean electronicComponents = false;//电子元器件标记

    @Column(name = "LABEL", columnDefinition = "NUMBER(2) default 0")
    @Comment("下载标签：0-不可下载；1-可下载")
    private Integer label = 0;
}
